<!--#include file="top.php" -->
<script type="text/javascript" src="../misc/vendors/o2js/o2grid/eo2grid.js"></script> 

<script type="text/javascript" >
var grids;
$().ready(function(){
	grids = new o2Grid({
		bind:'grids', 
		url:'<?=url('test','ajax_grid',array('reqtype'=>'json'))?>',
		imgpath:'misc/vendors/o2js/o2grid/image',
		height:250,
		className:'theme1',
		cols:[
			{index:'id',mapping:'a.id', name:'ID', width:40, align:'center'
			},
			{index:'name',mapping:'a.name', name:'学生', width:140,func:function(val,row_index,column_name,json,R){
				return '( '+json.number+' ) '+val;
			}},
			{index:'sex',mapping:'a.sex', name:'性别', width:70,func:function(val,row_index,column_name,json,R){
				if(val == '女'){
					return '<span style="color:red">女</span>';
				}else{
					return '<span style="color:green">男</span>';
				}
			}},
			{index:'classes',mapping:'a.classes', name:'班级', width:80
			},
			{index:'remark',mapping:'a.remark', name:'备注', width:121
			}
		],
		singleSelect:false,
		rowDblClick:function(obj,json,rowIndex,EventObject){
			alert(json.id);
		},
		baseParams:{
			test_val:'hehe'
		}
	});  
	grids.load(1); 	 
});


function fnSearch(){
	grids.setBaseParams({
		keys:$('#key').val()
	});
	grids.load(1);
}
function fnGetSlt(){
	alert(grids.getSelect());
	
}
</script>


搜索：<input type="text" id="key" /> <input type="button" value="查找" onclick="fnSearch()" />
<br />
<button onclick="fnGetSlt()">得到所选</button>
<div style="border:1px dashed #999999;margin:100px;padding:20px;">
	<div id="grids"></div>
</div>

<!--#include file="bottom.php" -->
